From c08bd7088d7c426ce612845935876e0ef00826fa Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Fri, 31 Oct 2003 16:36:13 +0000 Subject: [PATCH] bitkeeper revision 1.546 (3fa28f7diGvQF9o2YySrbVIsTMQmdw) current.h, entry.S: Correct stack arithmetic when esp is not a multiple of 4 (eg. in the middle of skanky pcibios code). --- xen/arch/i386/entry.S | 3 ++- xen/include/asm-i386/current.h | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/xen/arch/i386/entry.S b/xen/arch/i386/entry.S index 77ad757d62..953a2fe03d 100644 --- a/xen/arch/i386/entry.S +++ b/xen/arch/i386/entry.S @@ -161,7 +161,8 @@ NT_MASK = 0x00004000 #define GET_CURRENT(reg) \ movl $4096-4, reg; \ orl %esp, reg; \ - movl (reg),reg \ + andl $~3,reg; \ + movl (reg),reg; ENTRY(continue_nonidle_task) GET_CURRENT(%ebx) diff --git a/xen/include/asm-i386/current.h b/xen/include/asm-i386/current.h index 5a12a1201f..c2d2985788 100644 --- a/xen/include/asm-i386/current.h +++ b/xen/include/asm-i386/current.h @@ -6,7 +6,7 @@ struct task_struct; static inline struct task_struct * get_current(void) { struct task_struct *current; - __asm__ ( "orl %%esp,%0; movl (%0),%0" + __asm__ ( "orl %%esp,%0; andl $~3,%0; movl (%0),%0" : "=r" (current) : "0" (4092UL) ); return current; } @@ -15,7 +15,7 @@ static inline struct task_struct * get_current(void) static inline void set_current(struct task_struct *p) { - __asm__ ( "orl %%esp,%0; movl %1,(%0)" + __asm__ ( "orl %%esp,%0; andl $~3,%0; movl %1,(%0)" : : "r" (4092UL), "r" (p) ); } @@ -30,7 +30,7 @@ static inline execution_context_t *get_execution_context(void) static inline unsigned long get_stack_top(void) { unsigned long p; - __asm__ ( "orl %%esp,%0" + __asm__ ( "orl %%esp,%0; andl $~3,%0" : "=r" (p) : "0" (4092UL) ); return p; } -- 2.30.2